-- Tags: long

{% for rows_in_table in [1, 10, 100, 10000] %}
{% for wide in [0, 100000000] %}
drop table if exists data_02052_{{ rows_in_table }}_wide{{ wide }};
create table data_02052_{{ rows_in_table }}_wide{{ wide }} (key Int, value String)
engine=MergeTree()
order by key
settings
    min_bytes_for_wide_part={{ wide }}
as select number, repeat(toString(number), 5) from numbers({{ rows_in_table }});

-- avoid any optimizations with ignore(*)
select * apply max from data_02052_{{ rows_in_table }}_wide{{ wide }} settings max_read_buffer_size=1, max_threads=1;
select * apply max from data_02052_{{ rows_in_table }}_wide{{ wide }} settings max_read_buffer_size=0, max_threads=1; -- { clientError BAD_ARGUMENTS }

drop table data_02052_{{ rows_in_table }}_wide{{ wide }};
{% endfor %}
{% endfor %}
